﻿using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XW.Core;

namespace XW.Data
{
    /// <summary>
    /// 菜单实体
    /// </summary>
    [SugarTable(null, TableDescription = "菜单表")]
    public class SysMenu : EntityBase 
    {
        /// <summary>
        /// 菜单名
        /// </summary>
        [SugarColumn(ColumnDescription = "菜单名", Length = 32)]
        [Required, MaxLength(32)]
        public virtual string Name { get; set; }
        /// <summary>
        /// 图标
        /// </summary>
        [SugarColumn(ColumnDescription = "图标", Length = 32, IsNullable = true)] 
        public virtual string Icon { get; set; }
        /// <summary>
        /// 链接
        /// </summary>
        [SugarColumn(ColumnDescription = "链接", Length = 150, IsNullable =true)] 
        public virtual string Url { get; set; }

        /// <summary>
        /// 是否外链 1 是 0 否
        /// </summary>
        [SugarColumn(ColumnDescription = "是否外链 1 是 0 否",   IsNullable = true, DefaultValue = "0")]
        public virtual int Iframe { get; set; }

        /// <summary>
        /// 权限标识
        /// </summary>
        [SugarColumn(ColumnDescription = "权限标识", Length = 32, IsNullable = true)]
        [Required, MaxLength(32)]
        public virtual string permission { get; set; }

        /// <summary>
        /// 是否显示 1 是 0 否
        /// </summary>
        [SugarColumn(ColumnDescription = "是否显示 1 是 0 否", IsNullable = true, DefaultValue = "1")]
        public virtual int IsShow { get; set; }

        /// <summary>
        /// 是否显示 1 是 0 否
        /// </summary>
        [JsonConverter(typeof(LongJsonConverter))]
        [SugarColumn(ColumnDescription = "父菜单名", IsNullable = true, DefaultValue = "0")]
        public virtual long ParentId { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [SugarColumn(ColumnDescription = "备注", Length = 150, IsNullable = true)]
        [Required, MaxLength(150)]
        public virtual string Remark { get; set; }

        /// <summary>
        /// 菜单类型 0 普通菜单 1 按钮
        /// </summary>
        [SugarColumn(ColumnDescription = "菜单类型 0 普通菜单 1 按钮",  IsNullable = true, DefaultValue = "0")]
        public virtual int MenuType { get; set; }

        /// <summary>
        /// 状态 0 启用 1 禁用
        /// </summary>
        [SugarColumn(ColumnDescription = "状态 0 启用 1 禁用", IsNullable = true, DefaultValue = "0")]
        public virtual int Status { get; set; }

        /// <summary>
        /// js 方法
        /// </summary>
        [SugarColumn(ColumnDescription = "js 方法", Length = 150, IsNullable = true)] 
        public virtual string JsMethod { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        [SugarColumn(ColumnDescription = "排序", IsNullable = true, DefaultValue = "0")]
        public virtual int Sort { get; set; }
    }
}
